package com.heima.model.search.pojos;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 文章文档对象（映射Elasticsearch的索引库）
 */
@Data
@Document(indexName = "article")  //映射索引库
public class ArticleDocument {

    @Id  //映射ES的文档的主键值
    private Long id;

    /**
     * ES的默认分词器叫标准分词器（StandardAnalyzer）
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word") // 给title字段指定使用的分词器
    private String title;

    private Integer authorId;

    private String authorName;

    private Integer channelId;

    private String channelName;

    private Integer layout;

    private String images;

    private Integer likes;

    private Integer collection;

    private Integer comment;

    private Integer views;

    private Date createdTime;

    private Date publishTime;

    private String staticUrl;

}
